from django.db import models


# Create your models here.

class User(models.Model):
    uid = models.CharField(verbose_name='用户ID', max_length=20, unique=True)
    u_pwd = models.CharField(verbose_name='用户密码', max_length=20, null=False)
    u_registertime = models.DateTimeField(verbose_name='注册时间', auto_now_add=True)


class Admin(models.Model):
    admin_id = models.CharField(verbose_name='用户ID', max_length=20, unique=True)
    admin_pwd = models.CharField(verbose_name='用户密码', max_length=20)


class Project(models.Model):
    # pid = models.CharField(verbose_name='项目ID', max_length=20)
    p_name = models.CharField(verbose_name='项目名称', max_length=64)
    p_link = models.CharField(verbose_name='项目链接', max_length=256)
    p_uid = models.CharField(verbose_name='项目所属用户id', max_length=20)
    p_category = models.CharField(verbose_name='项目所属类别', max_length=32)
    p_releasetime = models.DateTimeField(verbose_name='发布时间', auto_now_add=True)
    p_prepic = models.CharField(verbose_name='项目预览图', max_length=128, null=True)
    p_info = models.CharField(verbose_name='项目介绍', max_length=4096)
    p_isrecommended = models.BooleanField(verbose_name='是否精选', default=False)


class Comment(models.Model):
    c_pid = models.CharField(verbose_name='项目ID', max_length=20)
    c_uid = models.CharField(verbose_name='作者ID', max_length=20)
    c_content = models.CharField(verbose_name='评论内容', max_length=256)
    c_pic = models.CharField(verbose_name='评论图片', max_length=128, null=True)
    c_commenttime = models.DateTimeField(verbose_name='评论时间', auto_now_add=True)


class Category(models.Model):
    # c_id = models.CharField(verbose_name='类别ID', max_length=20)
    c_name = models.CharField(verbose_name='类别名称', max_length=20)


class Announcement(models.Model):
    # a_id = models.CharField(verbose_name='公告ID', max_length=20)
    a_title = models.CharField(verbose_name='公告标题', max_length=64)
    a_content = models.CharField(verbose_name='公告内容', max_length=4096, null=True)
